package com.xsr.service.impl;

import com.xsr.mapper.UserMapper;
import com.xsr.pojo.User;
import com.xsr.service.UserService;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.beans.Transient;
import java.util.List;

/**
 * @author 邢式瑞
 * @version 1.0
 * @project gp14Sm
 * @date 2022/9/7 9:45
 */

public class UserServiceImpl implements UserService {
    private UserMapper userMapper;

    public UserServiceImpl(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    @Override
    public List<User> findAll() {
        return userMapper.SelectAll();
    }
    @Transactional(
       isolation = Isolation.DEFAULT ,
            propagation = Propagation.REQUIRED,
            timeout = 1

    )
    public void  insert(User user){
   userMapper.insert(user);
    }

    @Override
    public void deleteUserById(Integer id) {
        userMapper.deleteById(id);
    }

    @Override
    public void update(User user) {
       userMapper.update(user);
    }


}
